﻿using Leeder.Business;
using PickingGuide.Model;
using PickingGuide.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PickingGuide.Business
{
    /// <summary>
    /// 
    /// </summary>
    public class UserBLL : BaseBLL<UserModel, UserService>
    {
        public UserBLL()
        {
            Service = new UserService();
        }

        public UserModel Login(string userName, string password)
        {
            var result = Service.Query(x => (!x.IsPhantom || x.IsPhantom == null) && x.LoginName == userName && x.Password == password);
            if (result.IsSuccess)
            {
                return result.ActivedObj.FirstOrDefault();
            }
            else
            {
                LogObj.Error("登录失败！" + result.Dsca);
                return default;
            }
        }
    }
}
